Socket
Socket
Sign inDemoInstall

apache-arrow

Package Overview
Dependencies
Maintainers
6
Versions
43
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

apache-arrow

Apache Arrow columnar in-memory format


Version published
Weekly downloads
203K
increased by3.07%
Maintainers
6
Weekly downloads
 
Created

What is apache-arrow?

The apache-arrow npm package provides a cross-language development platform for in-memory data. It is designed to improve the performance and efficiency of data processing and analytics by using a columnar memory format. This package is particularly useful for handling large datasets and performing complex data manipulations.

What are apache-arrow's main functionalities?

Reading and Writing Arrow Files

This feature allows you to read and write Arrow files, which are efficient for storing and transferring large datasets. The code sample demonstrates how to read an Arrow file into a table and how to write a new table to an Arrow file.

const arrow = require('apache-arrow');
const fs = require('fs');

// Reading an Arrow file
const arrowFile = fs.readFileSync('data.arrow');
const table = arrow.Table.from([arrowFile]);
console.log(table.toString());

// Writing an Arrow file
const newTable = arrow.Table.new([{ name: 'Alice', age: 30 }, { name: 'Bob', age: 25 }]);
const arrowBuffer = newTable.serialize();
fs.writeFileSync('newData.arrow', arrowBuffer);

DataFrame Operations

This feature provides DataFrame-like operations, such as creating tables, selecting columns, and filtering rows. The code sample shows how to create a DataFrame, select a column, and filter rows based on a condition.

const arrow = require('apache-arrow');

// Creating a DataFrame
const df = new arrow.Table({
  name: arrow.Utf8Vector.from(['Alice', 'Bob']),
  age: arrow.Int32Vector.from([30, 25])
});

// Selecting a column
const names = df.getColumn('name');
console.log(names.toArray());

// Filtering rows
const filtered = df.filter(row => row.get('age') > 25);
console.log(filtered.toString());

Interoperability with Other Languages

Apache Arrow supports interoperability with other languages like Python, R, and Java. The code sample demonstrates how to create a table in JavaScript and pass it to Python using the pyarrow library.

const arrow = require('apache-arrow');
const pyarrow = require('pyarrow'); // Assuming you have a Python environment set up

// Create a table in JavaScript
const table = arrow.Table.new([{ name: 'Alice', age: 30 }, { name: 'Bob', age: 25 }]);
const arrowBuffer = table.serialize();

// Pass the buffer to Python
const pyTable = pyarrow.Table.from_buffer(arrowBuffer);
print(pyTable)

Other packages similar to apache-arrow

Keywords

FAQs

Package last updated on 22 Nov 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc